// 引入mockjs
const Mock = require('mockjs');
// 获取 mock.Random 对象
const { Random } = Mock;

// mock一组数据
const market = () => {
  let tableData = [];
  for (let i = 0; i < 10; i++) {
    let obj = {
      cat: Random.name(),
      sellMoney: Random.integer(100),
      sellMoneyPercent: Random.integer(0, 100),
      sellCount: Random.integer(1000),
      sellCountPercent: Random.integer(0, 100) // Random.date()指示生成的日期字符串的格式,默认为yyyy-MM-dd；Random.time() 返回一个随机的时间字符串
    };

    tableData.push(obj);
  }

  return {
    code: '200',
    list: tableData
  };
};

// Mock.mock( url, post/get , 返回的数据)；
Mock.mock('/api/market', 'post', market);

const cat = {
  code: 0,
  msg: '成功',
  data: [
    {
      id: '-30312049156287',
      name: '唐装/民族服装/舞台服装',
      wholeName: '女装/男装/内衣--女装/女士精品--唐装/民族服装/舞台服装',
      taobaoName: null,
      level: 3,
      active: 1
    },
    {
      id: '-30310672887661',
      name: '套装/学生校服/工作制服',
      wholeName: '女装/男装/内衣--女装/女士精品--套装/学生校服/工作制服',
      taobaoName: null,
      level: 3,
      active: 1
    },
    {
      id: '-30272068595816',
      name: '婚纱/旗袍/礼服',
      wholeName: '女装/男装/内衣--女装/女士精品--婚纱/旗袍/礼服',
      taobaoName: null,
      level: 3,
      active: 1
    },
    {
      id: '-30210825465886',
      name: '裤子',
      wholeName: '女装/男装/内衣--女装/女士精品--裤子',
      taobaoName: null,
      level: 3,
      active: 1
    },
    {
      id: '1623',
      name: '半身裙',
      wholeName: '女装/男装/内衣--女装/女士精品--半身裙',
      taobaoName: '女装/女士精品 >> 半身裙',
      level: 3,
      active: 1
    },
    {
      id: '1629',
      name: '大码女装',
      wholeName: '女装/男装/内衣--女装/女士精品--大码女装',
      taobaoName: '女装/女士精品 >> 大码女装',
      level: 3,
      active: 1
    },
    {
      id: '162103',
      name: '毛衣',
      wholeName: '女装/男装/内衣--女装/女士精品--毛衣',
      taobaoName: '女装/女士精品 >> 毛衣',
      level: 3,
      active: 1
    },
    {
      id: '162104',
      name: '衬衫',
      wholeName: '女装/男装/内衣--女装/女士精品--衬衫',
      taobaoName: '女装/女士精品 >> 衬衫',
      level: 3,
      active: 1
    },
    {
      id: '162116',
      name: '蕾丝衫/雪纺衫',
      wholeName: '女装/男装/内衣--女装/女士精品--蕾丝衫/雪纺衫',
      taobaoName: '女装/女士精品 >> 蕾丝衫/雪纺衫',
      level: 3,
      active: 1
    },
    {
      id: '162205',
      name: '牛仔裤',
      wholeName: '女装/男装/内衣--女装/女士精品--牛仔裤',
      taobaoName: '女装/女士精品 >> 牛仔裤',
      level: 3,
      active: 1
    },
    {
      id: '50000671',
      name: 'T恤',
      wholeName: '女装/男装/内衣--女装/女士精品--T恤',
      taobaoName: '女装/女士精品 >> T恤',
      level: 3,
      active: 1
    },
    {
      id: '50000697',
      name: '毛针织衫',
      wholeName: '女装/男装/内衣--女装/女士精品--毛针织衫',
      taobaoName: '女装/女士精品 >> 毛针织衫',
      level: 3,
      active: 1
    },
    {
      id: '50000852',
      name: '中老年女装',
      wholeName: '女装/男装/内衣--女装/女士精品--中老年女装',
      taobaoName: '女装/女士精品 >> 中老年女装',
      level: 3,
      active: 1
    },
    {
      id: '50008897',
      name: '西装',
      wholeName: '女装/男装/内衣--女装/女士精品--西装',
      taobaoName: '女装/女士精品 >> 西装',
      level: 3,
      active: 1
    },
    {
      id: '50008898',
      name: '卫衣/绒衫',
      wholeName: '女装/男装/内衣--女装/女士精品--卫衣/绒衫',
      taobaoName: '女装/女士精品 >> 卫衣/绒衫',
      level: 3,
      active: 1
    },
    {
      id: '50008899',
      name: '羽绒服',
      wholeName: '女装/男装/内衣--女装/女士精品--羽绒服',
      taobaoName: '女装/女士精品 >> 羽绒服',
      level: 3,
      active: 1
    },
    {
      id: '50008900',
      name: '棉衣/棉服',
      wholeName: '女装/男装/内衣--女装/女士精品--棉衣/棉服',
      taobaoName: '女装/女士精品 >> 棉衣/棉服',
      level: 3,
      active: 1
    },
    {
      id: '50008901',
      name: '风衣',
      wholeName: '女装/男装/内衣--女装/女士精品--风衣',
      taobaoName: '女装/女士精品 >> 风衣',
      level: 3,
      active: 1
    },
    {
      id: '50008904',
      name: '皮衣',
      wholeName: '女装/男装/内衣--女装/女士精品--皮衣',
      taobaoName: '女装/女士精品 >> 皮衣',
      level: 3,
      active: 1
    },
    {
      id: '50008905',
      name: '皮草',
      wholeName: '女装/男装/内衣--女装/女士精品--皮草',
      taobaoName: '女装/女士精品 >> 皮草',
      level: 3,
      active: 1
    },
    {
      id: '50010850',
      name: '连衣裙',
      wholeName: '女装/男装/内衣--女装/女士精品--连衣裙',
      taobaoName: '女装/女士精品 >> 连衣裙',
      level: 3,
      active: 1
    },
    {
      id: '50011277',
      name: '短外套',
      wholeName: '女装/男装/内衣--女装/女士精品--短外套',
      taobaoName: '女装/女士精品 >> 短外套',
      level: 3,
      active: 1
    },
    {
      id: '50013194',
      name: '毛呢外套',
      wholeName: '女装/男装/内衣--女装/女士精品--毛呢外套',
      taobaoName: '女装/女士精品 >> 毛呢外套',
      level: 3,
      active: 1
    },
    {
      id: '50013196',
      name: '马夹',
      wholeName: '女装/男装/内衣--女装/女士精品--马夹',
      taobaoName: '女装/女士精品 >> 马夹',
      level: 3,
      active: 1
    },
    {
      id: '121412004',
      name: '背心吊带',
      wholeName: '女装/男装/内衣--女装/女士精品--背心吊带',
      taobaoName: '女装/女士精品 >> 背心吊带',
      level: 3,
      active: 1
    },
    {
      id: '121434004',
      name: '抹胸',
      wholeName: '女装/男装/内衣--女装/女士精品--抹胸',
      taobaoName: '女装/女士精品 >> 抹胸',
      level: 3,
      active: 1
    }
  ],
  size: 0
};

// Mock.mock( url, post/get , 返回的数据)；
Mock.mock('/api/cat', 'post', cat);
